﻿<%@ Page Language="C#" MasterPageFile="~/cms/defaultLayout.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="cms_default" %>
<%@ MasterType  virtualPath="~/cms/defaultLayout.master"%>
<asp:Content ID="mainContent" ContentPlaceHolderID="main" runat="server">
        <form id="form1" runat="server">
            <div class="content">
           <div class="buttons"><center>
                <a id="A1" class="" runat="server" href="~/cms/film"><asp:Label ID="lblFilm" runat="server"/>[Film]</a> -
                <a id="A2" class="" runat="server" href="~/cms/planning"><asp:Label ID="lblplanning" runat="server" />[Planning]</a> -
                <a id="A3" class="" runat="server" href="~/cms/account"><asp:Label ID="lblAccount" runat="server"/>[Account]</a> -
                <a id="A4" class="" runat="server" href="~/cms/abonnement"><asp:Label ID="lblAbonnement" runat="server" />[Abonnement]</a> -
                <a id="A5" class="" runat="server" href="~/cms/zaal"><asp:Label ID="lblZaal" runat="server"/><b>[Zaal]</b></a> -
                <a id="A6" class="" runat="server" href="~/cms/vestiging"><asp:Label ID="lblVestiging" runat="server" />[Vestiging]</a> -
                <a id="A7" class="" runat="server" href="~/cms/user"><asp:Label ID="lblUser" runat="server"/>[User]</a> - 
               <a id="A8" class="" runat="server" href="~/cms/kaarten"><asp:Label ID="lblKaarten" runat="server"/>[Kaarten]</a>
                </center>
            </div>
            <p>This is "zaal" of CMS</p>
                <div class="cms_view" dir="ltr">

                    <asp:Button ID="Button1" runat="server" OnClick="InsertButton_Click" Text="New" />&nbsp;
                 <asp:Button ID="Button2" runat="server" Text="Cancel"  />&nbsp;
                     <br /><br />
              
             <asp:GridView  ShowFooter="True" ID="zaalGridView" runat="server" AutoGenerateColumns="False" CellPadding="3" ForeColor="Black" DataSourceID="SqlDataSource1" DataKeyNames="bioscoopbioscoop_id,zaalnummer" AllowSorting="True" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" GridLines="Vertical">
                    <AlternatingRowStyle BackColor="#CCCCCC" />
                    <Columns>
                        <asp:TemplateField ShowHeader="False">
                            <EditItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" validationgroup="Update" CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:Button>
                                &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:Button>
                            </ItemTemplate>
                            <FooterTemplate>
                               <asp:Button Id="insertButton" runat="server" OnClick="InsertButton_Click" causesvalidation="true" validationgroup="Footer" Text="Insert"  />
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="bioscoopbioscoop_id" SortExpression="bioscoopbioscoop_id">
                            <EditItemTemplate>
                                <asp:Label ID="lblBioscoopId" runat="server" Text='<%# Eval("bioscoopbioscoop_id") %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblBioscoopId" runat="server" Text='<%# Bind("bioscoopbioscoop_id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="naam" SortExpression="naam">
                            <EditItemTemplate>
                                <asp:Label ID="lblNaam" runat="server" Text='<%# Eval("naam") %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNaam" runat="server" Text='<%# Bind("naam") %>'></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                   <asp:DropDownList ID="Bioscoop_drop" Runat="server" DataSourceID="Bios" DataTextField="naam" DataValueField="bioscoop_id"></asp:DropDownList>

                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="zaalnummer" SortExpression="zaalnummer">
                            <EditItemTemplate>
                                <asp:Label ID="lblzaalnummer" runat="server" Text='<%# Eval("zaalnummer") %>'></asp:Label>

                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblzaalnummer" runat="server" Text='<%# Bind("zaalnummer") %>'></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="insertZaalnummer" runat="server"></asp:TextBox>
                                 <asp:CompareValidator ID="zaalCompareValidator"  Display="Dynamic" runat="server" validationgroup="Footer" ControlToValidate="insertZaalnummer" type="Integer" Operator="DataTypeCheck" ErrorMessage="Er mogen alleen getallen ingevoerd worden." ForeColor="Red"></asp:CompareValidator>
                                <asp:RequiredFieldValidator Display="Dynamic"  validationgroup="Footer" ID="zaalnummerRequiredValidator" runat="server" ControlToValidate="insertZaalnummer" ErrorMessage="Dit veld moet ingevuld zijn." ForeColor="Red"></asp:RequiredFieldValidator>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="rijen" SortExpression="rijen">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtRijen" runat="server" Text='<%# Bind("rijen") %>'></asp:TextBox>
                                 <asp:CompareValidator ID="rijenCompareValidator"   Display="Dynamic" runat="server" validationgroup="Update" ControlToValidate="txtRijen" type="Integer" Operator="DataTypeCheck" ErrorMessage="Er mogen alleen getallen ingevoerd worden." ForeColor="Red"></asp:CompareValidator>
                                <asp:RequiredFieldValidator Display="Dynamic" validationgroup="Update"  ID="rijenRequiredValidator" runat="server" ControlToValidate="txtRijen" ErrorMessage="Dit veld moet ingevuld zijn." ForeColor="Red"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="insertRijen" runat="server"></asp:TextBox>
                                 <asp:CompareValidator ID="rijenCompareValidator"  Display="Dynamic" runat="server" validationgroup="Footer" ControlToValidate="insertRijen" type="Integer" Operator="DataTypeCheck" ErrorMessage="Er mogen alleen getallen ingevoerd worden." ForeColor="Red"></asp:CompareValidator>
                                 <asp:RequiredFieldValidator Display="Dynamic" validationgroup="Footer" ID="FooterrijenRequiredValidator" runat="server" ControlToValidate="insertRijen" ErrorMessage="Dit veld moet ingevuld zijn." ForeColor="Red"></asp:RequiredFieldValidator>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblRijen" runat="server" Text='<%# Bind("rijen") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="zitting" SortExpression="zitting">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtZitting" runat="server" Text='<%# Bind("zitting") %>'></asp:TextBox>
                                <asp:CompareValidator ID="zittingCompareValidator" runat="server" Display="Dynamic"  validationgroup="Update" ControlToValidate="txtZitting" type="Integer" Operator="DataTypeCheck" ErrorMessage="Er mogen alleen getallen ingevoerd worden." ForeColor="Red"></asp:CompareValidator>
                                <asp:RequiredFieldValidator Display="Dynamic"  validationgroup="Update"   ID="zittingRequiredValidator" runat="server" ControlToValidate="txtZitting" ErrorMessage="Dit veld moet ingevuld zijn." ForeColor="Red"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                             <FooterTemplate>
                                <asp:TextBox ID="insertZitting" runat="server"></asp:TextBox>
                                 <asp:CompareValidator ID="zittingCompareValidator" runat="server" Display="Dynamic" validationgroup="Footer" ControlToValidate="insertZitting" type="Integer" Operator="DataTypeCheck" ErrorMessage="Er mogen alleen getallen ingevoerd worden." ForeColor="Red"></asp:CompareValidator>
                                 <asp:RequiredFieldValidator Display="Dynamic" validationgroup="Footer" ID="zittingRequiredValidator" runat="server" ControlToValidate="insertZitting" ErrorMessage="Dit veld moet ingevuld zijn."  ForeColor="Red"></asp:RequiredFieldValidator>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblZitting" runat="server" Text='<%# Bind("zitting") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>


                     

                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#808080" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#383838" />
                </asp:GridView>

                <asp:SqlDataSource ID="Bios" runat="server" ConnectionString='<%$ ConnectionStrings:debioscoopConnectionString %>' SelectCommand="SELECT [bioscoop_id], [naam] FROM [bioscoop]"></asp:SqlDataSource>

                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString='<%$ ConnectionStrings:debioscoopConnectionString %>'
                    OnSelected="Catch_SQLerror"
                    OnInserted="Catch_SQLerror"
                    OnDeleted="Catch_SQLerror"
                    OnUpdated="Catch_SQLerror"
                    DeleteCommand="DELETE FROM [zaal] WHERE [bioscoopbioscoop_id] = @original_bioscoopbioscoop_id AND [zaalnummer] = @original_zaalnummer AND [rijen] = @original_rijen AND [zitting] = @original_zitting"
                    InsertCommand="INSERT INTO [zaal] ([rijen], [zitting], [bioscoopbioscoop_id], [zaalnummer]) VALUES (@rijen, @zitting, @bioscoopbioscoop_id, @zaalnummer)"
                     OldValuesParameterFormatString="original_{0}"
                    SelectCommand="SELECT zaal.bioscoopbioscoop_id, bioscoop.naam, zaal.zaalnummer, zaal.rijen, zaal.zitting FROM zaal INNER JOIN bioscoop ON zaal.bioscoopbioscoop_id = bioscoop.bioscoop_id"  
                    UpdateCommand="UPDATE [zaal] SET [rijen] = @rijen, [zitting] = @zitting WHERE [bioscoopbioscoop_id] = @original_bioscoopbioscoop_id AND [zaalnummer] = @original_zaalnummer AND [rijen] = @original_rijen AND [zitting] = @original_zitting">
                    <DeleteParameters>
                        <asp:Parameter Name="original_bioscoopbioscoop_id" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_zaalnummer" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_rijen" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_zitting" Type="Int32"></asp:Parameter>
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="rijen" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="zitting" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="bioscoopbioscoop_id" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="zaalnummer" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="bioscoopnaam" Type="String" ></asp:Parameter>
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="rijen" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="zitting" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_bioscoopbioscoop_id" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_zaalnummer" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_rijen" Type="Int32"></asp:Parameter>
                        <asp:Parameter Name="original_zitting" Type="Int32"></asp:Parameter>
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:Label ID="SQLerrorLabel" runat="server" Text=""></asp:Label>
&nbsp;<div class="clearDiv"></div>
        </div>
        </form>
    </asp:Content>

